<?php
    require "config.php";
    $dbh = dbConnect();
    $id = $_GET['id'];
    $sql = "delete from diary where id = {$id}";
    $sth = $dbh->query($sql);
    if($sth){
        header("Location:after-message.php");
    }else{
        echo "<script>alert('对不起，操作失败！')</script>";
        echo "<script>window.location.href='after-message.php'</script>";
    }
?>